package com.itheima.innerClass.test6_6;

public class Test {
    public static void main(String[] args) {
        method(new Swim() {
            @Override
            public void Swimming() {
                System.out.println("铁汁,我们去游泳吧~");
            }
        });

        method(() ->{ System.out.println("铁汁,我们再去游泳吧~"); });

        SwimImpl swim = new SwimImpl();
        method(swim);
        method(swim);
        method(swim);
        method(swim);


    }
    //形参是接口类型时,未来实参要给该接口的实现类对象
    public static void method(Swim swim){
         /*
                Swim swim = new Swim() {
                    @Override
                    public void Swimming() {
                        System.out.println("铁汁,我们去游泳吧~");
                    }
                }
          */
        swim.Swimming();
    }

}

interface Swim{
    void Swimming();
}

class SwimImpl implements Swim{

    @Override
    public void Swimming() {
        System.out.println("铁汁,我们去游泳吧~");
    }
}
